package s3

import "strings"

type AccessOptions struct {
	EndpointUrl string
	AccessKey   string
	SecretKey   string
	Region      string
	Bucket      string
}

func (o *AccessOptions) Fill() {
	if !strings.HasPrefix(o.EndpointUrl, "http://") {
		o.EndpointUrl = "http://" + o.EndpointUrl
	}
}

type PutOptions struct {
	PutEnable     bool
	PutPrefix     string
	PutNum        int
	PutConcurrent int
	PutSize       int
}

func (o *PutOptions) Fill() {
	if !o.PutEnable {
		return
	}
	if o.PutConcurrent == 0 {
		o.PutConcurrent = 1
	}
}

type GetOptions struct {
}

type StatOptions struct {
}

type DeleteOptions struct {
	DeleteEnable     bool
	DeletePrefix     string
	DeleteBatchSize  int
	DeleteConcurrent int
	DeleteFollow     bool
}

func (o *DeleteOptions) Fill() {
	if !o.DeleteEnable {
		return
	}
	if o.DeleteConcurrent == 0 {
		o.DeleteConcurrent = 1
	}
}

type BenchOptions struct {
	PutOptions
	GetOptions
	StatOptions
	DeleteOptions
}

func (o *BenchOptions) Fill() {
	o.PutOptions.Fill()
	o.DeleteOptions.Fill()
}
